<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户考勤列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <input type="hidden" name="userId" th:value="${userId}"/>
                <div class="select-list">
                    <ul>
                        <li>
                            <label>打卡类型：</label>
                            <select name="checkingType" class="selectpicker"
                                    th:with="type=${@dict.getType('ecard_checking_type')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li class="select-date">
                            <label>打卡时间： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()"
               shiro:hasPermission="statistics:userChecking:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var checkingTypeDatas = [[${@dict.getType('ecard_checking_type')}]];
    var prefix = ctx + "statistics/userChecking";

    $(function () {
        var options = {
            url: prefix + "/list",
            exportUrl: prefix + "/export",
            modalName: "用户考勤",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'checkingType',
                    title: '打卡类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(checkingTypeDatas, value);
                    }
                },
                {
                    field: 'location',
                    title: '打卡地点'
                },
                {
                    field: 'createTime',
                    title: '打卡时间'
                },
                {
                    field: 'imgUrl',
                    title: '打卡照片',
                    formatter: function (value, row, index) {
                        return $.table.imageView(row.imgUrl, 700, 500);
                    }
                },
                {
                    field: 'memo',
                    title: '备注说明'
                },
                {
                    field: 'orgName',
                    title: '包保打卡机构'
                },
                {
                    field: 'userName',
                    title: '打卡人'
                },
                {
                    field: 'deptName',
                    title: '打卡人归属机构'
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>